package com.microservice.demo.client;

import com.einwin.framework.model.ResponseData;
import com.einwin.framework.utils.SpringUtils;
import com.microservice.demo.api.InputParameter;
import org.springframework.beans.factory.annotation.Autowired;
import com.microservice.demo.client.service.DemoService;
import org.springframework.stereotype.Component;

/**
 * Created by fqiang on 4/21/17.
 */
@Component
public class DemoClient {

    private static DemoService service;

    @Autowired
    public void setService(DemoService service) {
        DemoClient.service = service;
    }

//    private static DemoService obtainDemoService(){
//        DemoService service = (DemoService) SpringUtils.getBean("com.microservice.demo.client.service.DemoService");
//        System.out.println(service);
//        return service;
//    }


    public static ResponseData index(InputParameter abc) {

        System.out.println("DomeClient  input----- - "+abc.getId()+" "+abc.getName()+ "  ");
//        return obtainDemoService().index(abc);
        return service.index(abc);

    }
}
